import openllm

from langchain.llms import OpenLLM

class langchaindemo:
    def api_openllm(self):
        """
        使用openllm调用大模型,从而为应用建立API
        """

        llm = OpenLLM(server_url='127.0.0.1:3000')

        print(llm("What is the difference between a duck and a goose? And why there are so many Goose in Canada?") )
    
    def api_openllm_native(self):
        """
        使用openllm调用大模型,从而为应用建立API
        """
        client = openllm.client.HTTPClient('http://127.0.0.1:3000')
        print(client.query('Explain to me the difference between "further" and "farther"'))

testdemo = langchaindemo()
# testdemo.api_openllm_native()
testdemo.api_openllm()

 